<template>
	<div>{{ userInfo.name }}</div>
	<div>{{ userInfo.age }}</div>
	<button @click="change">子组件改变</button>
</template>

<script setup lang="ts">
import { inject } from 'vue'
const userInfo = inject('userInfo', { name: '这是默认值', age: 0 })
const change = () => {
	userInfo.name = '子组件修改'
	userInfo.age = 10
}
</script>
